﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;



namespace Blobby
{
    class Fireball : Sprite
    {
        const int MAX_DISTANCE = 500;
        public float Scale;
        public bool Visible = false;

        Vector2 Fireball_StartPos;
        Vector2 Fireball_Speed;
        Vector2 Fireball_Dir;

        public void LoadContent(ContentManager theContentManager)
        {
            base.LoadContent(theContentManager, "Fireball");

            Scale = 0.3f;
        }

        public void Update(GameTime theGameTime)
        {
            if (Vector2.Distance(Fireball_StartPos, Position) > MAX_DISTANCE)
            {
                Visible = false;
            }

            if (Visible == true)
            {
                base.Update(theGameTime, Fireball_Speed, Fireball_Dir);
            }
        }

        public override void Draw(SpriteBatch theSpriteBatch)
        {
            if (Visible == true)
            {
                base.Draw(theSpriteBatch);
            }
        }

        public void Fire(Vector2 theStartPosition, Vector2 theSpeed, Vector2 theDirection)
        {
            Position = theStartPosition;
            Fireball_StartPos = theStartPosition;
            Fireball_Speed = theSpeed;
            Fireball_Dir = theDirection;
            Visible = true;
        }


    }
}
